<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>出院通知</title>
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/themes/default/easyui.css"/>">
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/themes/icon.css"/>">
	
	<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
</head>
<body>
	<script type="text/javascript">
		$(function(){
			
			//显示全部住院通知单
			$("#xssy").linkbutton({onClick:function(){
				$("#tb-cytzs").datagrid({
    			url: 'selectcytz', 
    			method: 'get'
    			});
			}});
			
			$("#cysx").linkbutton({onClick:function(){
				
				var rows = $("#tb-cytz").datagrid("getSelections");
				if(rows.length==1){
					$("#his_cysx").window("open");
					
					var cyNo = rows[0].cyNo;
					
					var brNo = rows[0].brNo;
					//alert(cyNo);
					//alert(brNo);
					$.getJSON("brxx", {"brNo": brNo}, function(data){
						$("#form-cysx").form("load", data);
					});
				}
				
				else{
					$.messager.alert("提示", "只能选择一条记录，您目前选择了" + rows.length + "条!");
				}
			}});
			
			$("#tf").linkbutton({onClick:function(){
				
				var ye = document.getElementById("ye").value;
				
					if(ye>0){
					$("#his_tf").window("open");
					//document.getElementById("tfje").value = ye;
					$("#tfje").textbox("setValue", ye);
					$("#ye").textbox("setValue", 0);
					}
					else{
						$.messager.alert("提示", "该病人不符合退费");
					}
				}});
		
			
			$("#qrtf").linkbutton({onClick:function(){
				var rows = $("#tb-cytz").datagrid("getSelections");
					var ye = document.getElementById("tfje").value;
					//alert(ye)
					var brno = rows[0].brNo;
					var s ;
					$.getJSON("zytf", {"brno": brno,"ye":ye}, function(data){
						$.messager.alert("提示",data.reason);	
					});
					
					
					$("#his_tf").window("close");
					$("his_cysx").window("close");
								
				}});
			
			
			$("#qrcy").linkbutton({onClick:function(){
				var rows = $("#tb-cytz").datagrid("getSelections");
					var ye = document.getElementById("ye").value;
					
					if(ye==0){
					var brno = rows[0].brNo;
					var cyno = rows[0].cyNo;
					$.getJSON("cysx", {"brno": brno,"cyno":cyno}, function(data){
						$.messager.alert("提示",data.reason);	
					});
					$("his_cysx").window("close");
					}
					else{
						$.messager.alert("提示","病人费用为结算");
					}
				}});
			
		});
	</script>


	<table id="tb-cytz" class="easyui-datagrid" 
		data-options="url:'selectcytz',
			fitColumns:true,fit:true,
			pagination: true,
			pageSize: 5,
			pageList: [5, 10, 15, 20],
			rownumbers: true,
		
			align:'center',
			toolbar: '#ztgjl',
			"  >
		<thead>
			<tr>
				<th data-options="field:'cyNo',width:'3%', align:'center',checkbox: true">出院单号</th>
				<th data-options="field:'brNo',align:'center',width:'19%'">病人号</th>
				<th data-options="field:'brxm',align:'center',width:'19%'">姓名</th>
				<th data-options="field:'cwno',align:'center',width:'19%'">床位号</th>
				<th data-options="field:'ysmc',align:'center',width:'19%'">出院单医生</th>
				<th data-options="field:'ksmc',align:'center',width:'19%'">出院科室</th>
			</tr>
		</thead>
	</table>
	<!--工具栏-->
	<div id="ztgjl">
		<a  id="cyall" class="easyui-linkbutton" data-options="iconCls:'icon-xsqb',plain:true">所有待出院手续</a>
		<a  id="cysx" class="easyui-linkbutton" data-options="iconCls:'icon-rydj',plain:true">办理出院手续</a>
		<input id="his-cysearch" class="easyui-searchbox" data-options="width:220,prompt: '请输入诊疗卡号'">
	</div>
	<!--出院手续-->
	<div id="his_cysx" class="easyui-window" title="出院手续"  data-options="collapsible:false,minimizable:false,maximizable:false,modal:true,iconCls:'icon-rydj',closed: true" 
				style="width:400px;height:410px;padding:5px;">
			<div  style="padding:5px;border:0px ;height:318px;">
				<form id="form-cysx" action="" method="post" >
					<div class="item"><input name="brNo"   readonly="readonly"  class="easyui-textbox" data-options="label: '病人号：', width: 200"></div>
					<div class="item"><input name="brName"   readonly="readonly"  class="easyui-textbox" data-options="label: '病人姓名：', width: 200"></div>
					<div class="item"><input name="brAge" readonly="readonly"  class="easyui-textbox" data-options="label: '年龄：', width: 200"></div>
					<div class="item"><input name="brSex" readonly="readonly" class="easyui-textbox" data-options="label: '性别：', width: 200"></div>
					<div class="item"><input name="brTel" readonly="readonly" class="easyui-textbox" data-options="label: '联系方式：', width: 200"></div>
					<div class="item"><input name="brAddress" readonly="readonly" class="easyui-textbox" data-options="label: '家庭住址：', width: 230"></div>
					<div class="item"><input name="ye"  id="ye"  readonly="readonly" class="easyui-textbox" data-options="label: '费用余额：', width: 230"></div>
					<div class="item"><input name="brIdnumber" readonly="readonly" class="easyui-textbox" data-options="label: '身份证号：', width: 230"></div>
					<div class="item"><input name="ylkNo" readonly="readonly" class="easyui-textbox" data-options="label: '医疗卡号', width: 200"></div>
					<div class="item"><input name="ksmc" readonly="readonly" class="easyui-textbox " data-options="label: '科室：', width: 200"></div>
					<div class="item"><input name="brSituation" readonly="readonly" class="easyui-textbox" data-options="label: '病人情况：', width: 200"></div>
					<div class="item"><input name="cwNo" readonly="readonly" class="easyui-textbox" data-options="label: '床位', width: 200"></div>
					<div class="item"><input name="zyysNo" readonly="readonly" class="easyui-textbox" data-options="label: '住院医生', width: 200"></div>
					<div class="item"><input name="brDate" readonly="readonly" class="easyui-textbox" data-options="label: '入院时间：', width: 200"></div>
					<div id="qrcy"  class="easyui-linkbutton" plain="true" iconCls="icon-qr">确认出院</div>
					<div id="tf"  class="easyui-linkbutton" plain="true" iconCls="icon-tf">退费</div>
				</form>
				
			</div>
		
		
	</div>
		
		<div id="his_tf" class="easyui-window" title="患者出院退费"
		data-options="collapsible:false,minimizable:false,maximizable:false,modal:true,iconCls:'icon-xx',closed: true"
		style="width: 230px; height: 110px; padding: 5px;">

		<div>
				<input name="" id="tfje" readonly="readonly" class="easyui-textbox" data-options="label: '退费金额：', width: 200">
		</div>

		<div style="margin-top:5px;margin-right:5px;">
			<a  id="qrtf" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" style="float:right" >确定退费</a>
		</div>

	</div>
		
</body>
</html>